package org.patterns.structural.adapter;

public class Client {
    public static void main(String[] args) {
        //针对抽象目标接口编程，读取配置文件，反射生成对象
        ScoreOperation operation = (ScoreOperation) XMLUtil.getBean();
        int scores[] = {84, 76, 50, 96, 90, 91, 88, 69}; //定义成绩数组
        int result[];
        int score;

        System.out.println("成绩排序结果：");
        result = operation.sort(scores);

        //遍历输出成绩
        for (int i : result) {
            System.out.print(i + ",");
        }
        System.out.println();

        System.out.println("查找成绩 90：");
        score = operation.search(result, 90);
        if (score != -1) {
            System.out.println("找到成绩 90。");
        } else {
            System.out.println("没有找到成绩 90。");
        }

        System.out.println("查找成绩 92：");
        score = operation.search(result, 92);
        if (score != -1) {
            System.out.println("找到成绩 92。");
        } else {
            System.out.println("没有找到成绩 92。");
        }
    }
}